<template>
    <div class="view_entry">
        <form class="right" method="post" @submit="handleSubmit($event)">
            <h1 class="title">后台管理系统入口</h1>
            <div class="input_box">
                <label class="input_box-label">管理员账号</label>
                <input class="input_box-control" v-model="username" name="username" type="text" required />
            </div>
            <div class="input_box">
                <label class="input_box-label">管理员密码</label>
                <input class="input_box-control" v-model="password" name="password" type="password" required />
            </div>
            <button type="submit" class="enter_button">进入</button>
        </form>
    </div>
</template>

<script>
export default {
    data() {
        return {
            username: '',
            password: '',
        };
    },

    methods: {
        handleSubmit(e) {
            e.preventDefault();
            this.$root.logIn(this.username, this.password);
        },
    },
};
</script>